package com.yanfan.zutai.service.impl;


import com.yanfan.common.utils.DateUtils;
import com.yanfan.zutai.domain.BMqttSubscribe;
import com.yanfan.zutai.mapper.BMqttSubscribeMapper;
import com.yanfan.zutai.service.IBMqttSubscribeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * mqtt主题订阅Service业务层处理
 *
 * @author ruoyi
 * @date 2021-08-24
 */
@Service
public class BMqttSubscribeServiceImpl implements IBMqttSubscribeService {
    @Autowired
    private BMqttSubscribeMapper bMqttSubscribeMapper;

    /**
     * 查询mqtt主题订阅
     *
     * @param id mqtt主题订阅ID
     * @return mqtt主题订阅
     */
    @Override
    public BMqttSubscribe selectBMqttSubscribeById(Long id) {
        return bMqttSubscribeMapper.selectBMqttSubscribeById(id);
    }

    /**
     * 查询mqtt主题订阅列表
     *
     * @param bMqttSubscribe mqtt主题订阅
     * @return mqtt主题订阅
     */
    @Override
    public List<BMqttSubscribe> selectBMqttSubscribeList(BMqttSubscribe bMqttSubscribe) {
        return bMqttSubscribeMapper.selectBMqttSubscribeList(bMqttSubscribe);
    }

    /**
     * 新增mqtt主题订阅
     *
     * @param bMqttSubscribe mqtt主题订阅
     * @return 结果
     */
    @Override
    public int insertBMqttSubscribe(BMqttSubscribe bMqttSubscribe) {
        bMqttSubscribe.setCreateTime(DateUtils.getNowDate());
        return bMqttSubscribeMapper.insertBMqttSubscribe(bMqttSubscribe);
    }

    /**
     * 修改mqtt主题订阅
     *
     * @param bMqttSubscribe mqtt主题订阅
     * @return 结果
     */
    @Override
    public int updateBMqttSubscribe(BMqttSubscribe bMqttSubscribe) {
        bMqttSubscribe.setUpdateTime(DateUtils.getNowDate());
        return bMqttSubscribeMapper.updateBMqttSubscribe(bMqttSubscribe);
    }

    /**
     * 批量删除mqtt主题订阅
     *
     * @param ids 需要删除的mqtt主题订阅ID
     * @return 结果
     */
    @Override
    public int deleteBMqttSubscribeByIds(Long[] ids) {
        return bMqttSubscribeMapper.deleteBMqttSubscribeByIds(ids);
    }

    /**
     * 删除mqtt主题订阅信息
     *
     * @param id mqtt主题订阅ID
     * @return 结果
     */
    @Override
    public int deleteBMqttSubscribeById(Long id) {
        return bMqttSubscribeMapper.deleteBMqttSubscribeById(id);
    }
}
